package com.sportradar.assessment.work.threads;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sportradar.assessment.work.beans.StatisticsBean;
import com.sportradar.assessment.work.services.ExecutionManager;

public class StatisticsReporterThread implements Runnable {

	private static Logger logger=LoggerFactory.getLogger(StatisticsReporterThread.class);
	
	private ExecutionManager threadManager;

	public StatisticsReporterThread(ExecutionManager threadManager){
		this.threadManager=threadManager;
	}
	
	@Override
	public void run() {

		StatisticsBean statistics= threadManager.getStatistics();
		logger.info("Computation speed in last minute in NanoSeconds: "+statistics.getComputationSpeed());
		logger.info("Number of iteration in last minute: "+statistics.getIterationNumber());
		statistics.resetStatistics();
		
	}

}
